<template>
	<view class="order-list">
		<view class="head">
			<liuyuno-tabs class="tabs" :tabData="tabs" :defaultIndex="0" @tabClick='tabClick' />
		</view>
		<view class="list-info">
			<view class="no-order" v-if="order_list.length == 0">
				<view class="no-list">
					<image src="../../static/img/mine/zanwu.png"></image>
				</view>
			</view>
			<block v-for="(item,index) in order_list" :key="index">
				<view class="items">
					<view class="items-up" @click="goDetail(item)">
						<view class="title-parent">
							<view class="title-left">
								<text class="iconfont icon-home"></text>
								<text>甘肃文创</text>
							</view>
							<view class="status">

								<text v-if="item.status === '1'">等待发货</text>
								<text v-if="item.status === '2'">等待收货</text>
								<text v-if="item.status === '3'">交易完成</text>

							</view>
						</view>
						<view class="items-info">
							<view class="left">
								<image :src="item.listImage"></image>
							</view>
							<view class="right">
								<view class="right-up">
									<text>{{item.title}}</text>
								</view>
								<view class="right-down">
									<view>
										<text>共1件商品</text>
									</view>
									<view>
										<text>总计：</text>
										<text>{{item.costIntegral}} 积分</text>
									</view>
								</view>
							</view>
						</view>
					</view>
					<view class="items-down">
						<view class="pay" @click="goDetail(item)" v-if="item.status === '1'">
							<text>查看详情</text>
						</view>
					</view>
				</view>
			</block>
		</view>
		<view class="foot" :class="order_list.length > 2 ? '': 'foot-fixed'">
			<footLogo></footLogo>
		</view>
	</view>
</template>

<script>
	import liuyunoTabs from "@/components/liuyuno-tabs/liuyuno-tabs.vue";
	import footLogo from "@/components/foot-logo/footLogo.vue";
	export default {
		components: {
			liuyunoTabs,
			footLogo
		},
		data() {
			return {
				tabs: ['全部', '待发货', '待收货', '已完成'],
				order_list: [],

			};
		},
		onLoad: function(option) {
			this.getList('')
		},
		methods: {

			goDetail: function(item) {
				uni.navigateTo({
					url: '/pages/integralOrder/integralOrderDetail?id=' + item.id,
					animationType: 'pop-in',
					animationDuration: 200
				});
			},
			goPay: function(item) {
				let data = {
					payAmount: item.goodsOrderDetailList[0].totalAmount,
					orderId: item.id
				};
				uni.navigateTo({
					url: '/pages/scenicOrder/counter?data=' + JSON.stringify(data) + '&bustype=3',
					animationType: 'pop-in',
					animationDuration: 200
				});
			},
			tabClick: function(e) {
				console.log(e)
				this.getList(e)
			},
			getList: function(status) {
				let params = {
					memberId: this.pub.getUserInfo().memberId || '5269a26f41b54d81af30bdfccea7bd08',
					pageIndex: '1',
					pageSize: '10',
					status: status || ''
				}

				this.$postApi(this.$path.INTEGRAL_ORDER_LIST, params).then(res => {
					console.log("订单列表返回----------》", res.data)
					if (res.data.success) {
						this.order_list = res.data.data.list
					} else {
						this.order_list = []
						this.pub.showError(res.data.error.errorMessage)
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.order-list {
		background: #f2f2f2;
		padding: 0;
		margin: 0;
		font-size: 34upx;

		image {
			width: 100%;
			height: 100%;
		}

		min-height: 100%;
	}

	.head {
		// height: 100upx;
		padding-left: 100upx;
		// text-align: center;
		background: transparent;

		.tabs {
			font-size: 28upx;
			box-shadow: 0 0px 0px rgba(0, 0, 0, 0.0);
			background: #f2f2f2;

			// padding-left: 30upx;
			.underline {
				padding: 0 !important;
			}
		}
	}

	.list-info {


		.items {
			background: #fff;
			padding: 30upx;
			margin-top: 12upx;
			height: 358upx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
		}

		.title-parent {
			display: flex;
			justify-content: space-between;
			align-items: center;

			.title-left {
				font-size: 28upx;
				font-family: PingFang SC;
				font-weight: bold;
				color: rgba(26, 26, 26, 1);
			}

			.status {
				font-size: 24upx;
				font-family: PingFang SC;
				// font-weight:500;
				color: rgba(255, 94, 4, 1);
			}
		}

		.items-info {
			display: flex;
			margin-top: 30upx;
			border-bottom: 1upx solid #F8F8F8;
			padding-bottom: 40upx;

			.left {
				width: 112upx;
				height: 112upx;
				background: rgba(149, 149, 198, 1);
				border-radius: 7upx;

				image {
					border-radius: 7upx;
				}
			}

			.right {
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				width: 80%;
				margin-left: 20upx;

				.right-up {
					font-size: 34upx;
					font-family: PingFang SC;
					font-weight: bold;
					color: rgba(51, 51, 51, 1);
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}

				.right-down {
					display: flex;
					justify-content: space-between;

					view:first-child {
						font-size: 28upx;
						font-family: PingFang SC;
						font-weight: 500;
						color: rgba(102, 102, 102, 1);
					}

					view:last-child {
						font-size: 28upx;
						font-family: PingFang SC;
						font-weight: 500;
						color: rgba(102, 102, 102, 1);

						text:last-child {
							color: rgba(255, 94, 4, 1);
							font-size: 30upx;
						}
					}
				}
			}
		}

		.items-down {
			display: flex;
			justify-content: flex-end;
			align-items: center;

			view {
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 26upx;
				width: 139upx;
				height: 55upx;
				border: 1px solid rgba(204, 204, 204, 1);
				border-radius: 28upx;
				margin-left: 14upx;
			}

			.cancel,
			.del {
				color: rgba(128, 128, 128, 1);
			}

			.pay {
				color: rgba(255, 94, 4, 1);
				border: 1px solid rgba(255, 94, 4, 1);
			}
		}
	}
	.no-order{
		padding: 20upx;
		margin-top: 150upx;
		// height: 300upx;
	}
	.no-list{
		height: 435upx;
	}
	.foot{
		width: 100%;
	}
	.foot-fixed{
		position: fixed;
		bottom: 0;
	}
</style>
